How to detect online and offline of a machine through JavaScript? And display a message at the window?
Detect online and offline through JavaScript
583
20-Jul-2021
Updated on 20-Jul-2021
Anonymous User
04-Aug-2021The navigator.online property returns a boolean value either true or false, indicating whether the browser is in online mode or offline mode.
Syntax
navigator.onLine
Let's switch to the example for better understanding :
Hope this code will be helpful for you.
Happy Coding!